package com.imcode;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
public class ReaderDemo03 {
    public static void main(String[] args) {

        Reader fr = null;
        try {
            //1.创建一个按字符读取文件的对象
            fr = new FileReader("D:\\file\\db.properties");
            //2.定义一个字符数组
            char[] chars = new char[1024];
            int len = 0;
            while ((len = fr.read(chars)) != -1) {
                System.out.println(new String(chars, 0, len) + ".");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fr != null) {
                try {
                    fr.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
